package com.basic;

import com.frame.struts.BaseBean;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;
import com.utils.*;
import java.util.Date;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class MainSaleProductForm extends BaseBean {
    public MainSaleProductForm() {
    }
	MainSaleProductEntity mspe = new MainSaleProductEntity();
	public String addMainSaleProduct(){
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		mspe.setQyid(qyid);
		mspe.setOptdate(new Date());
		mspe.setOptrid(CommUtil.getUserId(request));
        try{
		if(factory.addMainSaleProduct(mspe))
		{
			//System.out.println("wo zhi xing le!");
			    response.sendRedirect(request.getContextPath()+"/basic/queryMainSaleProduct.jsp");
		}else{
		response.sendRedirect(request.getContextPath()+"/basic/failed.jsp");
		}
	   }
	   catch (Exception e) {

	   }

			return null;
	}
	public String modifyMainSaleProduct(){
		HttpServletRequest request = ActionContext.getActionContext().
			getRequest();
		HttpServletResponse response = ActionContext.getActionContext().
			getResponse();
		BasicFactory factory = new BasicFactory();
		String qyid = (String) request.getSession().getAttribute("session_qyid");
		mspe.setQyid(qyid);
		mspe.setOptdate(new Date());
		mspe.setOptrid(CommUtil.getUserId(request));
		System.out.println("cpid="+mspe.getCpid());
		//factory.deleteMainSaleProduct(mspe.getCpid());
        try{
		    if(factory.modifyMainSaleProduct(mspe))
	        {
	            //System.out.println("wo zhi xing le!");
	                response.sendRedirect(request.getContextPath()+"/basic/queryMainSaleProduct.jsp");
	        }else{
	        response.sendRedirect(request.getContextPath()+"/basic/failed.jsp");
	        }
	       }
	       catch (Exception e) {

	       }

	            return null;
	}

	/**
	 * @return mspe.getReturns the cpid.
	 */
	public int getCpid() {
		return mspe.getCpid();
	}
	/**
	 * @param cpid The cpid to set.
	 */
	public void setCpid(int cpid) {
		mspe.setCpid(cpid);
	}
	/**
	 * @return mspe.getReturns the cpmc.
	 */
	public String getCpmc() {
		return mspe.getCpmc();
	}
	/**
	 * @param cpmc The cpmc to set.
	 */
	public void setCpmc(String cpmc) {
		mspe.setCpmc(cpmc);
	}
	/**
	 * @return mspe.getReturns the jsxjx.
	 */
	public String getJsxjx() {
		return mspe.getJsxjx();
	}
	/**
	 * @param jsxjx The jsxjx to set.
	 */
	public void setJsxjx(String jsxjx) {
		mspe.setJsxjx(jsxjx);
	}
	/**
	 * @return mspe.getReturns the mlr.
	 */
	public String getMlr() {
		return mspe.getMlr();
	}
	/**
	 * @param mlr The mlr to set.
	 */
	public void setMlr(String mlr) {
		mspe.setMlr(mlr);
	}
	/**
	 * @return mspe.getReturns the ncl.
	 */
	public String getNcl() {
		return mspe.getNcl();
	}
	/**
	 * @param ncl The ncl to set.
	 */
	public void setNcl(String ncl) {
		mspe.setNcl(ncl);
	}
	/**
	 * @return mspe.getReturns the ncn.
	 */
	public String getNcn() {
		return mspe.getNcn();
	}
	/**
	 * @param ncn The ncn to set.
	 */
	public void setNcn(String ncn) {
		mspe.setNcn(ncn);
	}
	/**
	 * @return mspe.getReturns the ny.
	 */
	public String getNy() {
		return mspe.getNy();
	}
	/**
	 * @param ny The ny to set.
	 */
	public void setNy(String ny) {
		mspe.setNy(ny);
	}
	/**
	 * @return mspe.getReturns the optdate.
	 */
	public Date getOptdate() {
		return mspe.getOptdate();
	}
	/**
	 * @param optdate The optdate to set.
	 */
	public void setOptdate(Date optdate) {
		mspe.setOptdate(optdate);
	}
	/**
	 * @return mspe.getReturns the optrid.
	 */
	public String getOptrid() {
		return mspe.getOptrid();
	}
	/**
	 * @param optrid The optrid to set.
	 */
	public void setOptrid(String optrid) {
		mspe.setOptrid(optrid);
	}
	/**
	 * @return mspe.getReturns the qyid.
	 */
	public String getQyid() {
		return mspe.getQyid();
	}
	/**
	 * @param qyid The qyid to set.
	 */
	public void setQyid(String qyid) {
		mspe.setQyid(qyid);
	}
	/**
	 * @return mspe.getReturns the recstate.
	 */
	public String getRecstate() {
		return mspe.getRecstate();
	}
	/**
	 * @param recstate The recstate to set.
	 */
	public void setRecstate(String recstate) {
		mspe.setRecstate(recstate);
	}
	/**
	 * @return mspe.getReturns the remark.
	 */
	public String getRemark() {
		return mspe.getRemark();
	}
	/**
	 * @param remark The remark to set.
	 */
	public void setRemark(String remark) {
		mspe.setRemark(remark);
	}
	/**
	 * @return mspe.getReturns the xsze.
	 */
	public String getXsze() {
		return mspe.getXsze();
	}
	/**
	 * @param xsze The xsze to set.
	 */
	public void setXsze(String xsze) {
		mspe.setXsze(xsze);
	}
	/**
	 * @return mspe.getReturns the zxl.
	 */
	public String getZxl() {
		return mspe.getZxl();
	}
	/**
	 * @param zxl The zxl to set.
	 */
	public void setZxl(String zxl) {
		mspe.setZxl(zxl);
	}

}
